home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / dcsetenv.zip / SETENV.C < prev    next >
C/C++ Source or Header  |  1989-02-16  |  654b  |  37 lines

  1. /* setenv.c -- program to modify parent environment */
  2. /* by "David J. Camp" <david%wubios@wucs1.wustl.edu> */
  3.  
  4. #include <stdio.h>
  5. #include <stddef.h>
  6. #include <conio.h>
  7. #include <dos.h>
  8. #include <string.h>
  9.  
  10. int msetenv (char *, char *);
  11.  
  12. main(argc, argv)
  13. int argc;
  14. char * argv [];
  15.  
  16. {
  17. char varbuf[128];
  18. char * varloc;
  19. char * varname;
  20. char * eqloc;
  21. int i;
  22.  
  23. for (i = 2; i < argc; i++)
  24.     {
  25.     argv [i] [-1] = ' ';
  26.     }
  27. eqloc = strchr (argv [1], '=');
  28. if (argc <= 1 || eqloc == NULL)
  29.     {
  30.     fprintf (stderr,"usage: setenv variable=text\n");
  31.     exit (1);
  32.     }
  33. *eqloc = '\0';
  34. msetenv(argv [1], ++eqloc);
  35. exit(0);
  36. }
  37.